#include <iostream> 
using namespace std; 
int main() 
{ 
char a[3]; 
int n,t,temp=0; 
while (cin>>a) 
{ 
if (a[0]=='@')break; 
if (temp!=0)cout<<endl; 
temp=1; 
cin>>n; 
int i,j,k,t; 
t=n; 
if (n==1)cout<<a<<endl; 
else{ 
for (i=1;i<n;i++)cout<<' '; 
cout<<a<<endl; 
for (i=1;i<n-1;i++) 
{ 
t--; 
for (j=0;j<t-1;j++)cout<<' '; 
cout<<a; 
for (j=0;j<i*2-1;j++)cout<<' '; 
cout<<a; 
cout<<endl; 
} 
for (i=0;i<n*2-1;i++)cout<<a; 
cout<<endl; 
} 
} 
return 0; 
} 
